#include "CpLog.h"
#include "CpMagneticFieldMapObject.h"

ClassImp(CpMagneticFieldMapObject);

//______________________________________________________________________________
CpMagneticFieldMapObject::CpMagneticFieldMapObject(): TObject()
{
//
// Constructor
//

   Clear();

}

//______________________________________________________________________________
CpMagneticFieldMapObject::~CpMagneticFieldMapObject()
{
//
// Destructor.
//
}
//______________________________________________________________________________
void CpMagneticFieldMapObject::Clear()
{
//
// Resets object
//

   fPos[0] = 0.0;
   fPos[1] = 0.0;
   fPos[2] = 0.0;

   fMagField[0] = 0.0;
   fMagField[1] = 0.0;
   fMagField[2] = 0.0;
}

//______________________________________________________________________________
void CpMagneticFieldMapObject::Print()
{
//
// Print object's values
//

   CpInfo(Form("Position\t%.2f\t%.2f\t%.2f", fPos[0], fPos[1], fPos[2]));
   CpInfo(Form("Field\t%.2f\t%.2f\t%.2f", fMagField[0], fMagField[1], fMagField[2]));
}

//______________________________________________________________________________
void CpMagneticFieldMapObject::SetPosition(const Double_t &x, const Double_t &y, const Double_t &z)
{
//
// Sets position
//

   fPos[0] = x;
   fPos[1] = y;
   fPos[2] = z;
}

//______________________________________________________________________________
void CpMagneticFieldMapObject::SetMagField(const Double_t &bx, const Double_t &by, const Double_t &bz)
{
//
// Sets position
//

   fMagField[0] = bx;
   fMagField[1] = by;
   fMagField[2] = bz;
}
